package com.behome.netty.netty_B.handler;

import com.behome.netty.netty_B.bean.ReBackPacket;
import io.netty.channel.ChannelHandlerContext;

import java.net.InetSocketAddress;

/**
 * @author bh_ljy
 * @description: 附录B抽象处理器
 * @date: 2024/3/28 10:40
 */
public abstract class BusinessBHandlerBase {

    protected ChannelHandlerContext ctx;
    protected ReBackPacket msg;
    // 协议类型 0 内网 1公网
    protected int type;
    protected String ip;


    public BusinessBHandlerBase(ChannelHandlerContext ctx, ReBackPacket msg, int type) {
        this.ctx = ctx;
        this.msg = msg;
        this.type = type;
        InetSocketAddress insocket = (InetSocketAddress) ctx.channel().remoteAddress();
        this.ip = insocket.getAddress().getHostAddress();
    }

    public abstract void resolve() throws Exception;
}
